<template>
  <div class="main">
    <div class="dayi_top">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>答疑</el-breadcrumb-item>
        <el-breadcrumb-item>填写答疑的基本信息</el-breadcrumb-item>
      </el-breadcrumb>
      <hr />
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  <el-form-item style="width:500px" label="答疑主题" prop="name">
    <el-input v-model="ruleForm.name" placeholder="起个吸引人的主题，更能激发用户想你提问"></el-input>
  </el-form-item>
  
  <el-form-item label="结束时间" required>
    <el-col :span="11">
      <el-form-item prop="date2">
        <el-time-picker placeholder="选择时间" v-model="ruleForm.date2" style="width: 200px;"></el-time-picker>
      </el-form-item>
    </el-col>
  </el-form-item>
  <el-form-item  label="自习室封面" prop="name">
     <el-upload
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple
          >
            <i class="iconfont icon-B" style="font-size: 50px"></i>
            <div class="el-upload__text">请上传图片</div>
  <div class="el-upload__tip" slot="tip">建议尺寸374*544，JPG/PNG格式，图片小于10M</div>
</el-upload>
  </el-form-item>
  <el-form-item label="曝光标签" prop="region" >
    <el-select v-model="ruleForm.region" placeholder="本次答疑主要曝光给那个学习标签的用户" style="width:400px">
      <el-option label="标签一" value="shanghai"></el-option>
      <el-option label="标签二" value="beijing"></el-option>
    </el-select>
  </el-form-item>
  <div class="dayi_footer">
      <el-button type="success" :disabled="!checked">开始答疑</el-button>
  <el-checkbox v-model="checked">开始答疑即代表同意并支持<a href="#">《猩猩点灯文明公约》</a></el-checkbox>
  </div>
  
</el-form>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        ruleForm: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        checked:false,
        rules: {
          name: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '请选择活动区域', trigger: 'change' }
          ],
          date1: [
            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          ],
          date2: [
            { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
          ],
          type: [
            { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
          ],
          resource: [
            { required: true, message: '请选择活动资源', trigger: 'change' }
          ],
          desc: [
            { required: true, message: '请填写活动形式', trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>

<style>
.dayi_footer{
    display: flex;
    flex-direction: column;
    margin-left: 100px;
}
.dayi_footer .el-button{
    width: 150px;
    margin-bottom: 10px;
}
.dayi_footer a{
    text-decoration: none;
    color: #1cdaa4;
}
.dayi_top {
  margin: 20px 20px;
}
.main {
  width: 100%;
  background-color: #fff;
}
</style>